package com.company.app.service;

import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.xml.ws.WebServiceException;

import com.company.app.entities.Customer;

@Path("/CustomerService")
@WebService()
public interface CustomerService {
	
	/**
	 * Gets the customer by id.
	 *
	 * @return the customer by id
	 */
	@GET
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	@Path("/{id}")
	@WebMethod(operationName="gestCutomerByID")
	public @WebResult(name="customer", targetNamespace="http://entities.app.company.com") Customer getCustomerById(@WebParam(name="id") @PathParam ("id") Long id) throws WebServiceException;
	
	/**
	 * Search customer by filter.
	 *
	 * @return the customer
	 */
	@GET
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})	
	@Path("/searchCustomerByFilter/")
	@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
	@WebMethod(operationName="searchCustomerByFilter")
	public @WebResult(name="customerList", targetNamespace="http://List.lang.java") List<Customer> searchCustomerByFilter(@WebParam(name="customerFilter") @QueryParam("") Customer customer) throws WebServiceException;
	
	/**
	 * Execute customer bussiness logic.
	 *
	 * @return true, if successful
	 */
	@WebMethod(operationName="executeCustomerBussinessLogic")
	public boolean executeCustomerBussinessLogic();
	
	/**
	 * Creates the customer.
	 *
	 * @param customer the customer
	 * @return true, if successful
	 */
	@POST
	@Produces("text/plain")
	@Path("/createCustomer")
	@WebMethod(operationName="createCustomer")
	public @WebResult(name="success") boolean createCustomer(@WebParam(name="customerEntity") @QueryParam("") Customer customer) throws WebServiceException;
	
	/**
	 * Update customer.
	 *
	 * @param customer the customer
	 * @return true, if successful
	 */
	@PUT
	@Produces("text/plain")	
	@Path("/updateCustomer")
	@WebMethod(operationName="updateCustomer")
	public @WebResult(name="success") boolean updateCustomer(@WebParam(name="updateEntity") @QueryParam("") Customer customer) throws WebServiceException;
	
	/**
	 * Delete customer.
	 *
	 * @param customer the customer
	 * @return true, if successful
	 */
	@DELETE
	@Produces("text/plain")	
	@Path("/deleteCustomer")
	@WebMethod(operationName="deleteCustomer")
	public @WebResult(name="success") boolean deleteCustomer(@WebParam(name="deleteEntity") @QueryParam("") Customer customer) throws WebServiceException;
	
	@POST
	@Produces({"application/json", "application/xml"})	
	@Path("/createTmpObject")
	@WebMethod(operationName="createTmpObject")
	public @WebResult(name="Customer") Customer createTmpCustomer() throws WebServiceException;
		
}
